# #!/usr/bin/env python3

# import rclpy
# from sensor_msgs.msg import Image
# from manipulation.msg import ManiProcessCmd, TargetsList
# import cv2
# from cv_bridge import CvBridge

# bridge = CvBridge()

# def image_callback(msg):
#     #print(f"Received image with height: {msg.height}")
#     try:
#         cv_image = bridge.imgmsg_to_cv2(msg, desired_encoding='bgr8')
#         cv2.imshow("Detected Image", cv_image)
#         cv2.waitKey(1)  # Display the image for a short time
#     except Exception as e:
#         print(f"cv_bridge exception: {e}")

# if __name__ == '__main__':
#     rclpy.init()
#     node = rclpy.create_node('mytest_msg_node')
    
#     pub_cmd = node.create_publisher(ManiProcessCmd, 'mani_process_cmd', 10)
#     pub_targets = node.create_publisher(TargetsList, 'targets_list', 10)

#     sub_image = node.create_subscription(
#         msg_type=Image,
#         topic='/detected_image',
#         callback=image_callback, 
#         qos_profile=10,
#     )

#     node.create_subscription(Image, 'image_topic', lambda msg: print(f"Received image with height: {msg.height}"), 10)


#     cmd_msg = ManiProcessCmd()
#     cmd_msg.level1_name = "start"
#     pub_cmd.publish(cmd_msg)

#     targets_msg = TargetsList()
#     targets_msg.indexes = [1, 2]
#     pub_targets.publish(targets_msg)
#     node.get_logger().info('Published ManiProcessCmd and TargetsList messages')

#     rclpy.spin(node)
#     cv2.destroyAllWindows()
#     rclpy.shutdown()
